﻿<HTML>
<HEAD>
<TITLE>ARRAY Title</TITLE>
<META NAME="GENERATOR" Content="Microsoft FrontPage 4.0">
<META HTTP-EQUIV="imagetoolbar" CONTENT="NO">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache"> 
<META HTTP-EQUIV="Expires" CONTENT="-1"> 

 
<link href="kgrid_list.css" rel="stylesheet" type="text/css" />
    
<Script LANGUAGE="JavaScript" src="ajax_xmlhttp.js">
</Script>
<Script LANGUAGE="JavaScript" src="scw.js">
</Script>

<Script LANGUAGE="JavaScript">


function trimAll(sString)
{
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}


function trim(str, chars) {
    return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
    chars = chars || "\\s";
    return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}


//==============================================================================================================
//NEXT Part is AJAX Remote Scripting +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//==============================================================================================================

 function show_savepage(actionit, indxk, sortby, row_ID, page_ID, skipcount, pagesize, machchanged, arraychanged, sdatechanged)
 {                       
                   //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
                   //Change ajax called program name
                   var requestURLIT = 'ajax_kgrid_upd.php?action=' + actionit + '&r=' + new Date().getTime()
                   //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
                   var url = requestURLIT + '&num=' + indxk + '&sortby=' + sortby + '&rowid=' + row_ID + '&pageid=' + page_ID + '&skip=' + skipcount
                   url = url + '&pagesize=' + pagesize
                   //pass total record count, so as to see whether to use skipcount
                   url = url + '&totcount=' +   parent.document.getElementById('TotalNoRecords').value

                   //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
                   // May have to add other datagrid Search criteria
                   //Seeing if any Search or Sort fields have changed 
                   url = url + '&machchanged=' + machchanged + '&arraychanged=' + arraychanged + '&sdatechanged=' + sdatechanged 

                   //Add Search criteria next here 
                   url = url + '&arraysearch=' +   parent.document.getElementById('textsearch').value
                   //url = url + '&machsearch=' +   parent.document.getElementById('ddldropdown').value   

                   //Add Field Data to be saved here (put escape on all text fields)
                   url = url + '&machtosave=' + document.getElementById('ddldropdown').value
                   url = url + '&arraytosave=' + document.getElementById('textarray').value
                   url = url + '&startdatetosave=' + escape(document.getElementById('textsdate').value)
                   url = url + '&enddatetosave=' + escape(document.getElementById('textedate').value)
                   url = url + '&notetosave=' + document.getElementById('textnote').value
                   url = url + '&chktosave=' + document.getElementById('check1').checked
                  //url = url + '&notetosave=' + escape(document.getElementById('textnote').value)
                   //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&



                   //alert("url is " + url);
	           xmlHttp = GetXmlHttpObject(stateChangeHandlerSAVE); 
	           xmlHttp_Get(xmlHttp, url); 
 }


//Next function is just for delaying the Error Message a bit
//------------------------------------------------------------------------
function ShowAlert(str1) 
{ 
 alert(str1); 
}

//=======================================================================================================================================================
// Next functions are run after the above functions, so as to see when the Remote page has been completed
// stateChangeHandler will fire when the state has changed, i.e. data is received back 
// This is non-blocking (asynchronous) 
//=======================================================================================================================================================
function stateChangeHandlerSAVE() 
{ 
                           var rowID1;
	           //readyState of 4 or 'complete' represents that data has been returned 
                           if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')
                          { 
	             //Gather the results from the callback 
	             var str = xmlHttp.responseText; 
                                             
                             //Next 2 lines stop Progress Bar in Grid frame
                             parent.document.getElementById("pnlpopupprogress").style.display = "none";
                             //parent.document.getElementById('overlayprogress').style.visibility="hidden";


                             //If validation Error found, then display error concerned
                             if (str.substring(0,5) == "Error")
                             {
                                  setTimeout("ShowAlert(' " + str + " ')",100)     //so as to allow ProgressBar to finish(for Netscape)
                                  //alert(str);      
                             }
                             else
                             {

                                               parent.document.getElementById("pnlpopupprogress").style.display = "none";
                                               parent.document.getElementById('overlayprogress').style.visibility="hidden";

                                               if (str == "")     //only saving field not part of datagrid
                                                {
                                                   //do nothing
                                                }  
                                               else
                                                {
                                                  //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
                                                  //The next Part is you are using a datagrid LIST inconjunction (so can be taken out for standalone update form)
                                                  //------------------------------------------------------------------------------------------------------------------------

                                                  parent.document.getElementById('nameList2').innerHTML = str;

                                                  rowID1 = parent.document.getElementById('RowIDGet').value;
                                                 //alert("rowID1 is " + rowID1);

                                                 //Check if Search Criteria should be made blank, ie have changed a search criteria field(so do reload)
                                                 if (parent.document.getElementById('chkresetcriteria').value  == ' True ')
                                                 {
                                                    //parent.document.form1.ddldropdown.options[0].selected = true;    //Note: Must have values in dropdown to work
                                                    parent.document.getElementById('textsearch').value = "";
                                                 }

                                                 parent.resetablebg();
                                                 //set column sort header to a different background color
                                                 parent.setBgColor(parent.document.getElementById('SortFieldGet').value);
                                                 var table = parent.document.getElementById('myTable');
                                                 if (table)   
                                                 {
                                                  //Highlight 1st Row of new Page
                                                  table.rows[rowID1].style.backgroundColor="#F3F3F3";
                                                  //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
                                                  //Highlight Input Textbox row as well (Comment out if no Input Textbox used in List)
                                                  //parent.ARRAYSLIST.document.getElementById('aa' + rowID1 + 'c7').style.backgroundColor="silver";
                                                  //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
                                               
                                                  CloseUpd ();
                                                 }   
                                                //------------------------------------------------------------------------------------------------------------------------
                                                //END of Part if using a datagrid LIST inconjunction (so can be taken out for standalone update form
                                               //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


                                               }  //if (str == "")

                               }   // if (str.substring(0,5) == "Error")


                         }    // if (xmlHttp.readyState == 4 || xmlHttp.readyState == 'complete')

} 





//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//Please change as required
//------------------------------------------------------------------------------------------------------------------------------------------
function setFocus()
{
    //document.getElementById('ddldropdown').focus();
    //alert("PKID is " &document.getElementById('textcurrentpkid'));

}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&



//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//Please change as required
//---------------------------------------------------------------------------------------------------------------------------------------------
function SaveClick()
{
 //alert("Clicked on SAVE button2");
 var action = "reset";
 var indxk = document.getElementById('PK_ID').value;  //PKID

 var row_ID = 0;
 var skipcount = 0;
 var sortby = "";
 var pagesize = 0;
 var page_ID = 0;
 //Please change next 3 lines as required (ie Datagrid list Search and Sort fields)
 var MachChanged = 0;
 var ArrayChanged = 0;
 var SdateChanged = 0;
 //Please change next 3 lines as required (ie Datagrid list Search and Sort fields)
 var machtosave = "";
 var arraytosave = "";
 var startdatetosave = "";

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//The following lines are when there is a LIST used in conjunction, take out for standalone
 row_ID = parent.document.getElementById('RowIDGet').value;
 skipcount = parent.document.getElementById('SkipCount').value;
 sortby = parent.document.getElementById('SortFieldGet').value;
 pagesize = parent.document.getElementById('PageSizeGet').value;
 page_ID = parent.document.getElementById('CurrentPageGet').value;  
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
if (document.getElementById('ddldropdown').value != document.getElementById('orgMachine').value) 
{
 MachChanged = 1;
}

if (document.getElementById('textarray').value != document.getElementById('orgArrayName').value) 
{
 ArrayChanged = 1;
}

if (document.getElementById('textsdate').value != document.getElementById('orgStartDate').value) 
{
 SdateChanged = 1;
}

//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//NOTE:- Take out for standalone

 //if (action != "byitself")    //ie refreshing grid list again
 //if (page_ID > 5)
 //{
   parent.document.getElementById("pnlpopupprogress").style.display = "block";
   parent.document.getElementById('overlayprogress').style.visibility="visible";
 //}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&


//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//Please amend second line of next, for Search and Sort fields. NOTE:- Can leave as is for standalone
//--------------------------------------------------------------------------------------------------------------------------------------
 show_savepage(action, indxk, sortby, row_ID, page_ID, skipcount, pagesize, +
                         MachChanged, ArrayChanged, SdateChanged);
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

}




function CloseUpd () 
{
   parent.CloseUpd();
}


function CloseCal()
{
 document.getElementById("iframediv").style.display = "none";
 document.getElementById('overlayprogress').style.visibility="hidden";  //hides gray background
 overlay();  //hide iframe (popup)
}

function calstartpopup()
{
  
   //alert("in Calendar ");
   //New KLE Code for IFRAME POPUP alternative
   var ifram = document.getElementById('iframeupd');
   ifram.src = "kgrid_calendar.aspx?textbox=textsdate&textlabel=Start Date" 
       //            "&num=" + document.getElementById('textcurrentpkid').value;
                          
   document.getElementById("iframediv").style.display = "block";
   document.getElementById('overlayprogress').style.visibility="visible";   //shows gray background
   overlay();  //show iframe (popup)
                           
}


//Open or Closes iframe modal fake popup
function overlay() 
{
    //alert("open overlay");
    el = document.getElementById("overlay2");
    //el.style.visibility = (el.style.visibility == "visible") ? "hidden" : "visible";
    el.style.display = (el.style.display == "block") ? "none" : "block";
}


function testscw()
{
 //alert("after close scw");
}



</Script>


</head>


<!--&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-->
<body bgColor="white" onload="setFocus()">
<!--&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-->


<form name="form1" method="post" id="form1">


<!-- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-->
<!-- Storing HIDDEN variables (Customise) for checking for change in Sort and Search fields value -->
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<input name="ArrayName" type="text" id="ArrayName" style="VISIBILITY: hidden" />
<input name="MachineName" type="text" id="MachineName" style="VISIBILITY: hidden" />
<input name="StartDateCheck" type="text" id="StartDateCheck" style="VISIBILITY: hidden" />
<!-- +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-->
<!-- END Storing HIDDEN variables (Customise) for checking for change in field value -->
<!-- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&-->

<div id=overlay style="POSITION: absolute; 
             LEFT: 1px;  
             VISIBILITY: hidden;
             TOP: 1px; 
             HEIGHT: 900px;
             WIDTH: 900px;
             Z-INDEX: 300"> 
      <img src="images/PNG_1000x1000.png" alt="" />
</div>


<span style="POSITION: absolute; 
             OVERFLOW: hidden;
             LEFT: 0px;  
             TOP: 0px; 
             HEIGHT: 296px;
             WIDTH: 598px;
             BACKGROUND-COLOR: white;
             COLOR: black;
             FONT-WEIGHT: normal;
             FONT-SIZE: 14px; 
             FONT-FAMILY: arial; 
             FONT-STYLE: normal; 
             VISIBILITY: visible; 
             TEXT-ALIGN: center;
             TEXT-DECORATION: underline;
             TEXT-TRANSFORM: lowercase;
             VERTICAL-ALIGN: middle;
             BORDER-TOP: 1px solid black;
             BORDER-BOTTOM: 1px solid black;
             BORDER-LEFT: 1px solid black;
             BORDER-RIGHT: 1px solid black;
             Z-INDEX: 1"> 
  TEST Style
</span>


<div style="position: absolute; left: 2px; top: 2px; z-index: 100;">     
          <input id="Button344" type="button"  onclick="SaveClick()" style="text-align:center"
           value="Save" />
</div>

<div style="position: absolute; left: 47px; top: 2px; z-index: 100;">     
          <input id="Button345" type="button"  onclick="CloseUpd()" style="text-align:center"
           value="Cancel" />
</div> 



<!--Close Button using only Javascript-->
<span style="position: absolute; visibility: visible; left: 578px; top: 1px; z-index: 100">
      <a href="javascript:CloseUpd()">
           <img src="images/Close-image2.jpg" alt="Close" width="19" height="21" border="0">
      </a>
</span>





<span style="POSITION: absolute; 
             LEFT: 240px;  
             TOP: 4px; 
             HEIGHT: 30px;
             WIDTH: 200px;
             BACKGROUND-COLOR: white;
             COLOR: #396DA3;
             FONT-WEIGHT: bold;
             FONT-SIZE: 14px; 
             FONT-FAMILY: arial; 
             FONT-STYLE: normal; 
             Z-INDEX: 2">  
 Array Details
</span>



<!--Start of Machine field-->            
<span id="Machine" style="display:inline-block;height:21px;width:100px;FONT-WEIGHT: bold; 
                    FONT-SIZE: 12px; 
                    Z-INDEX: 100; 
                    LEFT: 118px; 
                    COLOR: black; 
                    FONT-STYLE: normal; 
                    FONT-FAMILY: arial; 
                    POSITION: absolute; 
                    TOP: 48px; 
                    BACKGROUND-COLOR: white">
               Machine:
</span>
    




<span id="lblarray" style="display:inline-block;height:21px;width:100px;FONT-WEIGHT: bold; 
                    FONT-SIZE: 12px; 
                    Z-INDEX: 100; 
                    LEFT: 357px; 
                    COLOR: black; 
                    FONT-STYLE: normal; 
                    FONT-FAMILY: arial; 
                    POSITION: absolute; 
                    TOP: 48px; 
                    BACKGROUND-COLOR: white">
               Array:
</span>  




<span style="POSITION: absolute; 
               LEFT: 79px; 
               TOP: 74px;  
               Z-INDEX: 100">
   <a href='#' onclick='scwShow(textsdate,textsdate);return false;'>
      <img SRC="images/calendar1.bmp" ALT="Select Date" 
     WIDTH="28" HEIGHT="28" border="0">
   </a>
</span>
<span id="StartDate" style="display:inline-block;height:21px;width:100px;FONT-WEIGHT: bold; 
                    FONT-SIZE: 12px; 
                    Z-INDEX: 100; 
                    LEFT: 109px; 
                    COLOR: black; 
                    FONT-STYLE: normal; 
                    FONT-FAMILY: arial; 
                    POSITION: absolute; 
                    TOP: 78px; 
                    BACKGROUND-COLOR: white">
               Start Date: 
</span>     





<span style="POSITION: absolute; 
               LEFT: 305px; 
               TOP: 74px;  
               Z-INDEX: 100">
   <a href='#' onclick='scwShow(textedate,textedate);return false;'>
      <img SRC="images/calendar1.bmp" ALT="Select Date" 
     WIDTH="28" HEIGHT="28" border="0">
   </a>
</span>
<span id="EndDate" style="display:inline-block;height:21px;width:100px;FONT-WEIGHT: bold; 
                    FONT-SIZE: 12px; 
                    Z-INDEX: 100; 
                    LEFT: 338px; 
                    COLOR: black; 
                    FONT-STYLE: normal; 
                    FONT-FAMILY: arial; 
                    POSITION: absolute; 
                    TOP: 78px; 
                    BACKGROUND-COLOR: white">
               End Date:
</span>     



<span id="lblnotes" style="display:inline-block;height:21px;width:75px;FONT-WEIGHT: bold; 
                    FONT-SIZE: 12px; 
                    Z-INDEX: 100; 
                    LEFT: 130px; 
                    COLOR: black; 
                    FONT-STYLE: normal; 
                    FONT-FAMILY: arial; 
                    POSITION: absolute; 
                    TOP: 117px; 
                    BACKGROUND-COLOR: white">
               Notes:
</span>  
                 




    <div id="overlayprogress" class="modalBackground22" style="position: absolute; left: 1px;
        visibility: hidden; top: 1px; height: 318px; width: 598px; z-index: 300">
    </div>
    <div id="overlay2">
        <div>
            <div id="iframediv" style="position: absolute; left: 45px; top: 38px; display: none;
                background-color: white; z-index: 400">
                <iframe id="iframeupd" width='280' height='220' frameborder='0' scrolling='no' src=''>
                </iframe>
            </div>
        </div>
    </div>
    



    <?php

      $strAction = $_REQUEST["action"];  
      $strPKID = $_REQUEST["num"];  
      $strSQL = "";
         
      $dsn2="SQLSERVER2005";
      $username2="sa";
      $password2="and";
  
      $sqlconnect2=odbc_connect($dsn2,$username2,$password2);

      $strSQL = "SELECT * from ARRAYS2 WHERE PK_ID = '" . $strPKID . "'";

      $rs=odbc_exec($sqlconnect2, $strSQL);

      while (odbc_fetch_row($rs))
         {
            //$intCounter = $rs(0);
            //$intCounter = $intCounter + 1;
            //$strArrayName = odbc_result($rs,"Array_Name");


            if (odbc_result($rs,"Array_Name") == ""
                   || (strlen(odbc_result($rs,"Array_Name")) == 0))      
            {
                $strArrayName = "&nbsp;";
            }
            else
            {
                $strArrayName = odbc_result($rs,"Array_Name");
            }



            if (odbc_result($rs,"loaded_machine") == ""
                   || (strlen(odbc_result($rs,"loaded_machine")) == 0))      
            {
                $strMachine = "";
            }
            else
            {
                $strMachine = odbc_result($rs,"loaded_machine");
            }



            if (odbc_result($rs,"Start_Date") == ""
                   || (strlen(odbc_result($rs,"Start_Date")) == 0))      
            {
                $strStartDate = "";
            }
            else
            {
               $strStartDate = odbc_result($rs,"Start_Date");

               $strstartyear = substr($strStartDate,0,4);
               $strstartmonth = substr($strStartDate,5,2);
               $strstartday = substr($strStartDate,8,2);

               // hour, minute, second,month,day,year
               //$my_birthday = gmmktime(0,0,0,10,3,1975);
               $my_date = gmmktime(0,0,0,$strstartmonth,$strstartday,$strstartyear );
                //print(date("M-d-Y",$my_birthday));
               //$strEndDate = date("m-d-Y",$my_date);
               $strStartDate = date("d/m/Y",$my_date);
            }



            if (odbc_result($rs,"End_Date") == ""
                   || (strlen(odbc_result($rs,"End_Date")) == 0))      
            {
                $strEndDate = "";
            }
            else
            {
               $strEndDate = odbc_result($rs,"End_Date");

               $strstartyear = substr($strEndDate,0,4);
               $strstartmonth = substr($strEndDate,5,2);
               $strstartday = substr($strEndDate,8,2);

               // hour, minute, second,month,day,year
               //$my_birthday = gmmktime(0,0,0,10,3,1975);
               $my_date = gmmktime(0,0,0,$strstartmonth,$strstartday,$strstartyear );
                //print(date("M-d-Y",$my_birthday));
               //$strEndDate = date("m-d-Y",$my_date);
               $strEndDate = date("d/m/Y",$my_date);
            }


            if (odbc_result($rs,"comment") == ""
                   || (strlen(odbc_result($rs,"comment")) == 0))      
            {
                $strComment = "";
            }
            else
            {
                $strComment = odbc_result($rs,"comment");
            }
           

            if (odbc_result($rs,"Complete_Flag") == ""
                   || (strlen(odbc_result($rs,"Complete_Flag")) == 0))      
            {
                $strFlag = "";
            }
            else
            {
                $strBoolean = odbc_result($rs,"Complete_Flag");
                if ($strBoolean == "True")
                {
                    $strFlag = "checked='CHECKED'";
                }
                else
                {
                    $strFlag = "";
                }
            }



         }





      //echo "in " . "<br/>";
      //echo $strPKID;
      $cRet = "";

      $cRet = $cRet . "<select name='ddldropdown' id='ddldropdown' tabindex='1' OnChange='javascript: SaveClick();' ";
      $cRet = $cRet . "   style='POSITION: absolute; ";
      $cRet = $cRet . "       LEFT: 171px; "; 
      $cRet = $cRet . "       TOP: 46px; ";
      $cRet = $cRet . "       HEIGHT: 19px; ";
      $cRet = $cRet . "       WIDTH: 110px; ";
      $cRet = $cRet . "       BACKGROUND-COLOR: white; ";
      $cRet = $cRet . "       COLOR: brown; ";
      $cRet = $cRet . "       FONT-WEIGHT: bold; ";
      $cRet = $cRet . "       FONT-SIZE: 12px; ";
      $cRet = $cRet . "       FONT-FAMILY: arial; ";
      $cRet = $cRet . "       FONT-STYLE: normal; ";
      $cRet = $cRet . "       Z-INDEX: 100' > ";


      $strSQL2 = "SELECT description FROM Machine order by description";

      $rs2=odbc_exec($sqlconnect2, $strSQL2);

      //show found Machine from Array first
      $cRet = $cRet . "<option value='" . $strMachine . "'>" . $strMachine . "</option>";


      while (odbc_fetch_row($rs2))
      {
            //$intCounter = $rs2(0);
            //$intCounter = $intCounter + 1;
            //$strArrayName = odbc_result($rs2,"Array_Name");


            if (odbc_result($rs2,"description") == ""
                   || (strlen(odbc_result($rs2,"description")) == 0))      
            {
                $strDescription = "";
            }
            else
            {
                $strDescription = odbc_result($rs2,"description");
            }


            if ($strDescription != $strMachine)
            {
              $cRet = $cRet . "<option value='" . $strDescription . "'>" . $strDescription . "</option>";
            }


      }   //end of While


      $cRet = $cRet . "</select>";


      odbc_close($sqlconnect2);



      //store original value, so as can check if changed
      $cRet = $cRet . "<input name='orgMachine' type='text' id='orgMachine' style='VISIBILITY: hidden' value='"
                    . $strMachine . "' />" . "\r\n";


      //echo $cRet;

      $cRet = $cRet . "<input name='PK_ID' type='text' id='PK_ID' style='VISIBILITY: hidden' value='"
                    . $strPKID . "' />" . "\r\n";


      $cRet = $cRet . "<input name='textarray' type='text' value='" . $strArrayName . "' id='textarray' tabindex='2' "; 
      $cRet = $cRet . "   style='POSITION: absolute; ";
      $cRet = $cRet . "       LEFT: 393px; "; 
      $cRet = $cRet . "       TOP: 46px; ";
      $cRet = $cRet . "       HEIGHT: 20px; ";
      $cRet = $cRet . "       BACKGROUND-COLOR: white; ";
      $cRet = $cRet . "       COLOR: black; ";
      $cRet = $cRet . "       FONT-WEIGHT: bold; ";
      $cRet = $cRet . "       FONT-SIZE: 12px; ";
      $cRet = $cRet . "       FONT-FAMILY: arial; ";
      $cRet = $cRet . "       FONT-STYLE: normal; ";
      $cRet = $cRet . "       Z-INDEX: 100' /> ";

      //store original value, so as can check if changed
      $cRet = $cRet . "<input name='orgArrayName' type='text' id='orgArrayName' style='VISIBILITY: hidden' value='"
                    . $strArrayName . "' />" . "\r\n";



      $cRet = $cRet . "<input name='textsdate' type='text' value='" . $strStartDate . "' id='textsdate' tabindex='3' OnChange='javascript: SaveClick();' ";
      $cRet = $cRet . "   style='POSITION: absolute; ";
      $cRet = $cRet . "       LEFT: 171px; "; 
      $cRet = $cRet . "       TOP: 76px; ";
      $cRet = $cRet . "       HEIGHT: 19px; ";
      $cRet = $cRet . "       WIDTH: 70px; ";
      $cRet = $cRet . "       BACKGROUND-COLOR: white; ";
      $cRet = $cRet . "       COLOR: black; ";
      $cRet = $cRet . "       FONT-WEIGHT: normal; ";
      $cRet = $cRet . "       FONT-SIZE: 11px; ";
      $cRet = $cRet . "       FONT-FAMILY: arial; ";
      $cRet = $cRet . "       FONT-STYLE: normal; ";
      $cRet = $cRet . "       Z-INDEX: 100' /> ";

      //store original value, so as can check if changed
      $cRet = $cRet . "<input name='orgStartDate' type='text' id='orgStartDate' style='VISIBILITY: hidden' value='"
                    . $strStartDate . "' />" . "\r\n";



      $cRet = $cRet . "<input name='textedate' type='text' value='" . $strEndDate . "' id='textedate' tabindex='4' OnChange='javascript: SaveClick();' ";
      $cRet = $cRet . "   style='POSITION: absolute; ";
      $cRet = $cRet . "       LEFT: 393px; "; 
      $cRet = $cRet . "       TOP: 76px; ";
      $cRet = $cRet . "       HEIGHT: 19px; ";
      $cRet = $cRet . "       WIDTH: 70px; ";
      $cRet = $cRet . "       BACKGROUND-COLOR: white; ";
      $cRet = $cRet . "       COLOR: black; ";
      $cRet = $cRet . "       FONT-WEIGHT: normal; ";
      $cRet = $cRet . "       FONT-SIZE: 11px; ";
      $cRet = $cRet . "       FONT-FAMILY: arial; ";
      $cRet = $cRet . "       FONT-STYLE: normal; ";
      $cRet = $cRet . "       Z-INDEX: 100' /> ";


      $cRet = $cRet . "<textarea name='textnote' rows='2' cols='20' id='textnote' tabindex='5' ";
      $cRet = $cRet . "   style='POSITION: absolute; ";
      $cRet = $cRet . "       LEFT: 171px; "; 
      $cRet = $cRet . "       TOP: 117px; ";
      $cRet = $cRet . "       HEIGHT: 45px; ";
      $cRet = $cRet . "       WIDTH: 240px; ";
      $cRet = $cRet . "       BACKGROUND-COLOR: white; ";
      $cRet = $cRet . "       COLOR: blue; ";
      $cRet = $cRet . "       FONT-WEIGHT: normal; ";
      $cRet = $cRet . "       FONT-SIZE: 11px; ";
      $cRet = $cRet . "       FONT-FAMILY: arial; ";
      $cRet = $cRet . "       FONT-STYLE: normal; ";
      $cRet = $cRet . "       Z-INDEX: 100' />";
      $cRet = $cRet . $strComment . "";
      $cRet = $cRet . "</textarea>";



      $cRet = $cRet . "<span style='HEIGHT: 50px; ";
      $cRet = $cRet . "      LEFT: 71px; ";
      $cRet = $cRet . "      FONT-SIZE: 12px; ";
      $cRet = $cRet . "      COLOR: Blue; ";
      $cRet = $cRet . "      FONT-FAMILY: arial; ";
      $cRet = $cRet . "      POSITION: absolute; ";
      $cRet = $cRet . "      TOP: 170px; ";
      $cRet = $cRet . "      WIDTH: 270px; ";
      $cRet = $cRet . "      Z-INDEX: 100'> ";
      $cRet = $cRet . "<label for='check1'>Completed?</label>";
      $cRet = $cRet . "<input id='check1' type='checkbox' name='check1'" . $strFlag . " onclick='javascript: SaveClick();' tabindex='6' /> ";
      $cRet = $cRet . "</span>";



      echo $cRet;

      //phpinfo();

    ?>



</form>


</BODY>

</HTML>



